package com.haizhi.crm.sys.configure.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 用户自定义模块可配置的几大种类
 * Created by caochao on 2018/05/31.
 */
@AllArgsConstructor
@Getter
public enum ModuleSettingCategory {
    MODULE_NAME("name", "模块名称" ),      //模块名称
    DATA_RANGE("data_range", "显示范围" ), //数据范围
    FIELD("field", "显示字段" ),           //显示字段
    PAGE_SZIE("page_size", "默认行数" ),   //显示数据条数
    ;

    private String code;
    private String name;

    public static ModuleSettingCategory codeOf(String code) {
        return Arrays.stream(values()).filter(category -> code.equals(category.getCode())).findFirst().orElse(null);
    }
}
